var webdir='http://www.2admin.co.cc';
  var events=[]; 
  var arraydata=[];
$(document).ready(function() {



setcalendar();







}); 
function setevent(obj)
{
   var dateset= $(obj).attr('date');

   var activity=arraydata[dateset+'-activity'];
   var subcalendar=arraydata[dateset+'-subcalendar'];
//   alert(arraydata[dateset+'-title']);
   $('.black').html(arraydata[dateset+'-title']);
   $('.latest').html('');
   for(variable in subcalendar)
   {
       var obj = subcalendar[variable];
       $('.latest').append('<li><span class="time">'+obj.timeset+'</span>'+obj.detail+'</li>');
   }
   $('.h').html('');
   for(variable in activity)
   {
       var obj = activity[variable];
       $('.h').append(' <li><a href="javascript:void(0);" class="icon map-12">'+obj.actname+'</a></li>');
   }
   $('.dateshow').html(arraydata[dateset+'-dateshow']);
   
   
   
   
}
function setevent2(dateset)
{
     

   var activity=arraydata[dateset+'-activity'];
   var subcalendar=arraydata[dateset+'-subcalendar'];
//   alert(arraydata[dateset+'-title']);
   $('.black').html(arraydata[dateset+'-title']);
   $('.latest').html('');
   for(variable in subcalendar)
   {
       var obj = subcalendar[variable];
       $('.latest').append('<li><span class="time">'+obj.timeset+'</span>'+obj.detail+'</li>');
   }
   $('.h').html('');
   for(variable in activity)
   {
       var obj = activity[variable];
       $('.h').append(' <li><a href="javascript:void(0);" class="icon map-12">'+obj.actname+'</a></li>');
   }
   $('.dateshow').html(arraydata[dateset+'-dateshow']);
}
function setcalendar()
{
    $.post(webdir+'/ajax.php',{functioncall:'getcalendar'} ,function(data) {
    var options = {
onMonthChanged: function(dateIn) {
return true;
}
};

 var myObject = eval('(' + data + ')');
 var k=0;
 for (variable in myObject.data)
 {  
            var obj = myObject.data[variable]; 
            var arraydate2=obj.dateset.split("-"); 
            events[k]={ EventID:k+1, "Date": new Date(arraydate2[0], parseInt(arraydate2[1])-1, arraydate2[2])};
            k++;
           arraydata[parseInt(arraydate2[1])+'/'+parseInt(arraydate2[2])+'/'+arraydate2[0]+'-activity']=obj.activity;  
           arraydata[parseInt(arraydate2[1])+'/'+parseInt(arraydate2[2])+'/'+arraydate2[0]+'-subcalendar']=obj.subcalendar;  
          // alert(parseInt(arraydate2[1])+'/'+parseInt(arraydate2[2])+'/'+arraydate2[0]+'-title');
           arraydata[parseInt(arraydate2[1])+'/'+parseInt(arraydate2[2])+'/'+arraydate2[0]+'-title']=obj.title;   
           arraydata[parseInt(arraydate2[1])+'/'+parseInt(arraydate2[2])+'/'+arraydate2[0]+'-dateshow']=obj.dateshow;  
           if(obj.datenow)
           {
               setevent2(obj.datenow);
           }
                     
 }

$.calendar.Initialize(options,events);

});
}